<template>
  <div class="container-big wing-blank forward-detail-page">
    <div class="forward-give-card">
      <div class="alibaba-design" />
      <div class="forward-give-card-info">
        <div class="forward-give-ucan-title">
          <img
            src="https://gw.alicdn.com/tfs/TB1j1kNHbPpK1RjSZFFXXa5PpXa-201-32.png"
            class="logo-title"
          >
          设计大会
        </div>
        <p class="forward-give-card-sub-title">
          [门票转送通知]
        </p>
        <div class="forward-give-card-transfer">
          <span>{{ticket.uName || '-'}}<em> (馈赠人)</em></span>
          <svg
            class="transfer-icon"
            viewBox="0 0 26 10"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            xmlns:xlink="http://www.w3.org/1999/xlink"
          >
            <g
              id="Page-1"
              stroke="none"
              stroke-width="1"
              fill="none"
              fill-rule="evenodd"
            >
              <g
                id="转送完成"
                transform="translate(-221.000000, -379.000000)"
                fill-rule="nonzero"
                stroke="#FFFFFF"
              >
                <polyline
                  id="Path-2"
                  points="221 387.549673 246 387.549673 237.450327 379"
                />
              </g>
            </g>
          </svg>
          <span>{{ticket.ext3 || '-'}}<em> (受赠人)</em></span>
        </div>
        <div class="forward-give-active-code">
          <span class="code-label">
            激活码
          </span>
          <div class="code-value">
            {{ticket.inviteCode}}
          </div>
        </div>
      </div>
      <p class="forward-give-card-use-desc">
        受赠⼈务必在 2019年年4⽉月25⽇ 零点前激活转送票, 逾期将失效.
        请勿随意将激活码转送陌⽣⼈, 激活码仅限1⼈使用.
      </p>
      <!-- <div class="forward-give-card-desc">
        <div class="forward-give-card-desc-wrapper">
          <div class="forward-give-card-qrcode" />
          <div class="forward-give-card-content-message">
            <p>操作说明:</p>
            <p>第1步: 识别当前⼆二维码打开转送激活⻚页;</p>
            <p>第2步: 在激活⻚页填写必要信息后激活转送票;</p>
            <p>第3步: 成功激活后登录钉钉Ucan票务查看.</p>
          </div>
        </div>
      </div> -->
    </div>
    <div class="forward-give-actions">
      <!-- <co-button
        class="give-action"
        outline
      >
        下载
      </co-button> -->
      <co-button
        class="give-action"
        color="primary"
        :disabled="!ticket.inviteCode"
        @click.stop="share"
      >
        分享给受赠人
      </co-button>
    </div>
  </div>
</template>
<script>
import dd from 'dingtalk-jsapi';
import shareIcon from './share-icon';
import mineService from '../../api/mine';
export default {
  data() {
    return {
      ticket: {},
    }
  },
  components: {
    shareIcon
  },
  mounted() {
    this.fetchTicketList();
  },
  methods: {
    async fetchTicketList() {
      const { activityId, ticketId } = this.$route.query;
      const ticket =  await mineService.getTicket(activityId, ticketId);
      this.ticket = ticket
    },
    share() {
      dd.biz.util.share({
        url: `${location.origin}${location.pathname}#/forward/active?code=${this.ticket.inviteCode}`,
        title: 'UCAN 2019 — 转赠票',
        content: `您收到了1张来自 ${this.ticket.uName || '-'} 的转送门票`,
        image: 'https://gw.alicdn.com/tfs/TB1OC5pKsfpK1RjSZFOXXa6nFXa-260-320.png',
        onSuccess : function() {
          console.log('sucess');
        },
        onFail : function(err) {
          console.log(err);
        }
      })
    }
  }
};
</script>
<style lang="less">
.forward-detail-page {
  padding-top: 30px;
  text-align: left;
  .forward-give-card {
    background: url(https://img.alicdn.com/tfs/TB1PH3nKxTpK1RjSZFMXXbG_VXa-1380-936.png) no-repeat;
    background-size: 100%;
    position: relative;
    padding: 0 2px 30px;
    .alibaba-design {
      left: 40px;
      top: 24px;
      width: 91px;
      height: 16px;
    }
    .give-share-icon {
      font-size: 56px;
      position: absolute;
      right: 24px;
      top: 24px;
    }
  }

  .forward-give-ucan-title {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    font-size: 40px;
    .logo-title {
      width: 200px;
      margin-right: 5px;
    }
  }

  .forward-give-card-sub-title {
    font-size: 40px;
  }

  .forward-give-card-transfer {
    margin-top: 40px;
    display: flex;
    align-items: center;
    font-size: 28px;
    color: #fff;
    .transfer-icon {
      width: 26px;
      height: 10px;
      margin-left: 16px;
      margin-right: 16px;
    }
    em {
      font-style: normal;
      font-size: 20px;
      color: #D7D8D9;
    }
  }

  .forward-give-active-code {
    margin-top: 20px;
    display: flex;
    align-items: center;
    .code-label {
      font-size: 24px;
      color: #fff;
      white-space: nowrap;
      margin-right: 16px;
    }
    .code-value {
      flex: 1;
      height: 68px;
      background: rgba(0, 0, 0, .5);
      font-size: 32px;
      border-radius: 3px;
      text-align: center;
      line-height: 68px;
    }
  }
  .forward-give-card-desc {
    padding-left: 24px;
    padding-right: 24px;
  }
  .forward-give-card-desc-wrapper {
    padding: 24px 0;
    border-bottom: 1px dotted #979797;
    display: flex;
    align-items: center;
  }
  .forward-give-card-qrcode {
    width: 140px;
    height: 140px;
    background-color: fade(#D8D8D8, 30%);
    margin-right: 10px;
    flex-shrink: 0;
  }

  .forward-give-card-content-message {
    color: #fff;
    > p {
      font-size: 22px;
      white-space: nowrap;
      line-height: 38px;
      &:first-child {
        font-size: 24px;
      }
    }
  }
  .forward-give-card-use-desc {
    padding: 0 24px;
    font-size: 20px;
    color: rgba(255, 255, 255, .8);
  }

  .forward-give-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 60px;
    .give-action {
      height: 90px;
      flex: 1;
      margin-left: 26px;
      white-space: nowrap;
      font-size: 30px;
      &:first-child {
        margin-left: 0;
      }
    }
  }
}

.forward-give-card-info {
  padding: 40px 32px 24px 40px;
  margin-bottom: 45px;
}
</style>
